package com.njtcedu.microblog.website.content.service;

import java.util.List;
import javax.inject.Inject;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import com.njtcedu.microblog.common.entity.Content;
import com.njtcedu.microblog.common.web.domain.PageModel;
import com.njtcedu.microblog.website.content.repository.ContentRepository;
import com.njtcedu.microblog.website.content.web.request.ContentSearchRequest;
import com.njtcedu.microblog.website.content.web.response.ContentResponse;
import com.njtcedu.microblog.website.home.web.response.CurrentUser;

@Service
@Transactional
public class ContentService {

	@Inject
	private ContentRepository contentRepository;

	public ContentResponse sendMessage(CurrentUser currentUser, String sendContent, String contentType) {
		return contentRepository.sendMessage(currentUser,sendContent, contentType);
	}
	
	public List<ContentResponse> getAllContents() {
		return contentRepository.getAllContent();
	}
	
	public List<Content> getContents() {
		return contentRepository.getContents();
	}

	public PageModel<ContentResponse> getAllContents(ContentSearchRequest request, Integer pageNo, Integer pageSize) {
		return contentRepository.getAllContent(request, pageNo, pageSize);
	}

	public boolean removeContent(Integer contentId) {
		return contentRepository.removeContent(contentId);
	}
	
}
